<?php

/**
 * Varswitch filter form base class.
 *
 * @package    seth
 * @subpackage filter
 * @author     Fuz
 * @version    SVN: $Id: sfDoctrineFormFilterGeneratedTemplate.php 29570 2010-05-21 14:49:47Z Kris.Wallsmith $
 */
abstract class BaseVarswitchFormFilter extends BaseFormFilterDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'dev'        => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Powerdev'), 'add_empty' => true)),
      'sampletime' => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate(), 'with_empty' => false)),
      'source'     => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'sourceid'   => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'vac'        => new sfWidgetFormFilterInput(),
      'iac'        => new sfWidgetFormFilterInput(),
      'vac12'      => new sfWidgetFormFilterInput(),
      'vac23'      => new sfWidgetFormFilterInput(),
      'vac13'      => new sfWidgetFormFilterInput(),
      'iac1'       => new sfWidgetFormFilterInput(),
      'iac2'       => new sfWidgetFormFilterInput(),
      'iac3'       => new sfWidgetFormFilterInput(),
      'f'          => new sfWidgetFormFilterInput(),
      'state'      => new sfWidgetFormFilterInput(),
      'event'      => new sfWidgetFormFilterInput(),
    ));

    $this->setValidators(array(
      'dev'        => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('Powerdev'), 'column' => 'id')),
      'sampletime' => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 00:00:00')), 'to_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 23:59:59')))),
      'source'     => new sfValidatorPass(array('required' => false)),
      'sourceid'   => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'vac'        => new sfValidatorSchemaFilter('text', new sfValidatorNumber(array('required' => false))),
      'iac'        => new sfValidatorSchemaFilter('text', new sfValidatorNumber(array('required' => false))),
      'vac12'      => new sfValidatorSchemaFilter('text', new sfValidatorNumber(array('required' => false))),
      'vac23'      => new sfValidatorSchemaFilter('text', new sfValidatorNumber(array('required' => false))),
      'vac13'      => new sfValidatorSchemaFilter('text', new sfValidatorNumber(array('required' => false))),
      'iac1'       => new sfValidatorSchemaFilter('text', new sfValidatorNumber(array('required' => false))),
      'iac2'       => new sfValidatorSchemaFilter('text', new sfValidatorNumber(array('required' => false))),
      'iac3'       => new sfValidatorSchemaFilter('text', new sfValidatorNumber(array('required' => false))),
      'f'          => new sfValidatorSchemaFilter('text', new sfValidatorNumber(array('required' => false))),
      'state'      => new sfValidatorPass(array('required' => false)),
      'event'      => new sfValidatorPass(array('required' => false)),
    ));

    $this->widgetSchema->setNameFormat('varswitch_filters[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'Varswitch';
  }

  public function getFields()
  {
    return array(
      'id'         => 'Number',
      'dev'        => 'ForeignKey',
      'sampletime' => 'Date',
      'source'     => 'Text',
      'sourceid'   => 'Number',
      'vac'        => 'Number',
      'iac'        => 'Number',
      'vac12'      => 'Number',
      'vac23'      => 'Number',
      'vac13'      => 'Number',
      'iac1'       => 'Number',
      'iac2'       => 'Number',
      'iac3'       => 'Number',
      'f'          => 'Number',
      'state'      => 'Text',
      'event'      => 'Text',
    );
  }
}
